package com.usian.admin.controller.v1;

import com.usian.admin.service.AdSensitiveService;
import com.usian.apis.admin.AdSensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName: AdSensitiveController
 * Author:   WGG
 * Date:    2022-11-2022/11/10-16:34
 * Version: 1.0
 * Description:
 */
@RestController
@RequestMapping("/admin/api/v1/sensitive")
@Api(value = "敏感词管理",tags = "sensitive",description = "敏感词管理API")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService;

    @Override
    @PostMapping("list")
    public ResponseResult findByPageAndName(@RequestBody SensitiveDto sensitiveDto) {
        return adSensitiveService.findByPageAndName(sensitiveDto);
    }

    @Override
    @PostMapping("save")
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.saveSensitive(adSensitive);
    }

    @Override
    @PostMapping("update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.updateSensitive(adSensitive);
    }

    @Override
    @DeleteMapping("del/{id}")
    public ResponseResult del(@PathVariable Integer id) {
        return adSensitiveService.del(id);
    }

}
